import json
import sys

VSCODE_SETTING_PATH = "/home/houzl/.config/Code/User/settings.json"

COLOR = str(sys.argv[1])
# COLOR = 'dark'
# COLOR = 'light'

if COLOR == 'dark':
    theme = "Atom One Dark"
elif COLOR == 'light':
    theme = "Atom One Light"

with open(VSCODE_SETTING_PATH, 'r') as originfile:
    jsonfile = originfile.read()
    # print(jsonfile)
    settings = json.loads(jsonfile)
    # print(settings)
    settings["workbench.colorTheme"] = theme
    jsonfile = json.dumps(settings, indent=4)
    with open(VSCODE_SETTING_PATH, 'w') as newfile:
        newfile.write(jsonfile)
